#ifndef PASSWORDDIALOG_H
#define PASSWORDDIALOG_H

#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include "digitalkeyboard.h"

class PasswordDialog : public QDialog {
    Q_OBJECT
public:
    explicit PasswordDialog(QWidget *parent = nullptr);

private slots:
    void validateInputs();       // 实时验证输入合法性
    void onConfirm();
    void exitApplication();

private:
    QLineEdit* createPasswordEdit(QString text);

private:
    QLabel* titleLabel;
    QLineEdit *oldPasswordEdit;   // 旧密码输入
    QLineEdit *newPasswordEdit;   // 新密码输入
    DigitalKeyboard* keyboard;
    QPushButton *confirmButton;
    QPushButton *cancelButton;

    void applyStyles();

protected:
    bool eventFilter(QObject *watched, QEvent *event) override;
};

#endif // PASSWORDDIALOG_H
